/*
 * @Descripttion: 
 * @version: 
 * @Author: cyj
 * @Date: 2023-04-19 23:27:58
 */
const express = require('express')

const router = express.Router()

const FriendRouter = require('../router_handle/addfriend')

//好友申请
router.post('/friend', (req, res) => {
    let data = req.body
    FriendRouter.applyFriend(data, res)
})

//同意好友
router.post('/agreeFriend', (req, res) => {
    let { uid, fid } = req.body
    FriendRouter.updateFriendState(uid, fid, res)
    FriendRouter.updateFriendState(fid, uid, res)
    res.sendMsg('success', 200)
})

//拒绝|删除好友
router.post('/deleteFriend', (req, res) => {
    let { uid, fid } = req.body
    FriendRouter.deleteFriend(uid, fid, res)
    FriendRouter.deleteFriend(fid, uid, res)
    res.sendMsg('success', 200)
})

module.exports = router